<?php
if (isset($this->isSubmenuDisabled) && $this->isSubmenuDisabled == true) {
    return;
}
$tmp = isset($this->submenu) ? $this->submenu : null;
$this->submenu = array();
try {
    $txt = $this->render('common/submenu/' . $this->menuSelected . '.phtml');
    $submenu = $this->submenu;
    if (!empty($submenu)) {
        $submenuSelected = isset($this->submenuSelected) ? $this->submenuSelected : 'index';
        ?>
        <div class="navbar">
            <div class="navbar-inner">
                <ul class="nav">
                    <?php foreach ($submenu as $val): ?>
                        <?php
                        $isActite = (is_array($val['activator']) && in_array($submenuSelected, $val['activator']))
                                || (is_string($val['activator']) && $val['activator'] == $submenuSelected);
                        ?>
                        <li class="<?= $isActite ? 'active' : '' ?>">
                            <a href="<?= $val['url'] ?>"><?= $val['title'] ?></a>
                        </li>
                        <li class="divider-vertical"></li>
                    <?php endforeach ?>
                </ul>
            </div>
        </div>
        <?php
    }

    echo $txt;
} catch (Exception $ex) {
    echo '<!-- submenu is disabled -->';
}
$this->submenu = $tmp;
?>